﻿''' <summary>
''' which property shall be the searchable text of the content
''' </summary>
''' <remarks></remarks>
Public Class SearchText
    Inherits MysteryPropertyAttribute


    Public Overrides Sub setup()

    End Sub

    Private Const db_limit As Integer = 50

    Public Function getSearchText(content As IContent) As String
        Dim value As Object = Me.retrive()(content)
        If TypeOf (value) Is ContentPropertyValue Then
            value = DirectCast(value, ContentPropertyValue).getValue
        End If
        If value Is Nothing Then Return String.Empty
        Dim as_string As String = value
        as_string = as_string.Trim.ToLower
        If as_string.Length > db_limit Then
            as_string = as_string.Substring(0, db_limit)
        End If

        Return as_string
    End Function

End Class
